# 标识版本号
cmake_minimum_required(VERSION 3.10)

#编辑项目名字
project(my_avl)

# 搜寻所有
aux_source_directory(src SRCS)

#将源文件放进项目中
add_executable(my_avl ${SRCS})


option( ENABLE_ASAN "Enable AddressSanitizer" ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

include(FetchContent)
FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.12.0/json.tar.xz)
FetchContent_MakeAvailable(json)


if (ENABLE_ASAN)
    message("enable asan")
    target_compile_options(my_avl PRIVATE -fsanitize=address)
    target_link_options(my_avl PRIVATE -fsanitize=address)
endif()

target_link_libraries(my_avl PRIVATE nlohmann_json::nlohmann_json)



target_include_directories(my_avl PUBLIC ${CMAKE_SOURCE_DIR}/include)

target_link_libraries(my_avl PUBLIC cjson cunit)


